function CMenu(oData) {
    var _oContainerStack;
    var _oBlackboard;
    var _btnpre;
    var _btnnxt;
    var _btnsetting;
    var _self;

    var _pStartPosAudio;
    var _oAudioToggle;

    var _curPage;
    var _maxPage;
    var _pageSize = 10;
    var _omenus = [];
    var _thisData;
    var _btnpredis;
    var _btnnxtdis;

    this._init = function () {
        _oContainerStack = new createjs.Container();
        s_oStage.addChild(_oContainerStack);

        _oBlackboard = createBitmap(s_oSpriteLibrary.getResult('blackboard'));
        _oContainerStack.addChild(_oBlackboard);

        _btnpre = createBitmap(s_oSpriteLibrary.getResult('pre'));
        _btnpre.x = 410;
        _btnpre.y = 5;
        _oContainerStack.addChild(_btnpre);
        _btnpre.on("mousedown", this.preButtonDown);
        _btnpre.on("pressup", this.preButtonRelease);
        _btnpredis = createBitmap(s_oSpriteLibrary.getResult('pre-dis'));
        _btnpredis.x = 410;
        _btnpredis.y = 5;
        _oContainerStack.addChild(_btnpredis);

        _btnnxt = createBitmap(s_oSpriteLibrary.getResult('next'));
        _btnnxt.x = 580;
        _btnnxt.y = 5;
        _oContainerStack.addChild(_btnnxt);
        _btnnxt.on("mousedown", this.nxtButtonDown);
        _btnnxt.on("pressup", this.nxtButtonRelease);
        _btnnxtdis = createBitmap(s_oSpriteLibrary.getResult('nxt-dis'));
        _btnnxtdis.x = 580;
        _btnnxtdis.y = 5;
        _oContainerStack.addChild(_btnnxtdis);

        _btnsetting = createBitmap(s_oSpriteLibrary.getResult('star'));
        _btnsetting.x = 780;
        _btnsetting.y = 5;
        _oContainerStack.addChild(_btnsetting);

        this._initPage(_thisData);
        if (DISABLE_SOUND_MOBILE === false || s_bMobile === false) {
            var _btnshengyin = s_oSpriteLibrary.getResult('soundsprite');
            _pStartPosAudio = {x: CANVAS_WIDTH - (_btnshengyin.height / 2) - 15, y: (_btnshengyin.height / 2) + 15};
            _oAudioToggle = new CToggle(240, (_btnshengyin.height / 2) + 5, _btnshengyin, s_bAudioActive, _oContainerStack);
            //_oAudioToggle.addEventListener(ON_MOUSE_UP, this._onAudioToggle, this);
        }
        this.setToolsStatus();
        this._reflush();
    };

    /**
     * 设置菜单状态
     */
    this.setToolsStatus = function () {
        if (_curPage == 1) {
            _btnpre.visible = false;
            _btnpredis.visible = true;
        } else {
            _btnpre.visible = true;
            _btnpredis.visible = false;
        }
        if (_curPage == _maxPage) {
            _btnnxt.visible = false;
            _btnnxtdis.visible = true;
        } else {
            _btnnxt.visible = true;
            _btnnxtdis.visible = false;
        }
    };

    this._initPage = function (oData) {
        var linenum = oData.datas.length;
        _maxPage = Math.ceil(linenum / _pageSize);
        _curPage = 1;
    };

    this._unloadMenu = function () {
        for (var i = 0; i < _omenus.length; i++) {
            _omenus[i].unload();
        }
        _omenus.splice(0, _omenus.length);//清空数组
        console.log("_omenus is " + _omenus);
    };

    this._reflush = function () {
        if (_curPage < 1)
            return "";

        var begin = (_curPage - 1) * _pageSize;
        var end = _curPage * _pageSize;
        if (_curPage >= _maxPage) {
            end = Math.max(_curPage * _pageSize, _thisData.datas.length);
        }

        var index = 0;
        for (var i = begin; i < end; i++, index++) {
            var tb = new CTextButton(240, 100 + index * 50, oData.datas[i].menu, "STKaiti","#ffffff", 36, _oContainerStack);
            tb.addEventListener(ON_MOUSE_UP, this._onSiteLogoRelease, this, _thisData.datas[i].key);
            _omenus.push(tb);
        }
    };

    this.preButtonDown = function () {
        _btnpre.scaleX = 0.9;
        _btnpre.scaleY = 0.9;
    };
    this.preButtonRelease = function () {
        _btnpre.scaleX = 1;
        _btnpre.scaleY = 1;

        _curPage--;
        if (_curPage < 1) {
            _curPage = 1;
            s_oMenu.setToolsStatus();
            return;
        }
        s_oMenu.setToolsStatus();
        // 卸除所有的对象
        s_oMenu._unloadMenu();
        s_oMenu._reflush();
    };

    this.nxtButtonDown = function () {
        _btnnxt.scaleX = 0.9;
        _btnnxt.scaleY = 0.9;
    };
    this.nxtButtonRelease = function () {
        _btnnxt.scaleX = 1;
        _btnnxt.scaleY = 1;

        _curPage++;
        if (_curPage > _maxPage) {
            _curPage = _maxPage;
            s_oMenu.setToolsStatus();
            return;
        }
        s_oMenu.setToolsStatus();
        // 卸除所有的对象
        s_oMenu._unloadMenu();
        s_oMenu._reflush();
    };

    this._onSiteLogoRelease = function(key){
        // this.fadeAnim();
        s_oMenu.setVisible();
        s_oMain.gotoGame(key);
    };

    this.fadeAnim = function () {
        s_oMenu.setVisible();
        s_oMain.gotoGame();
    };

    this.setVisible = function (flag) {
        _oContainerStack.visible = flag;
    };

    _self = this;
    _thisData = oData;
    s_oMenu = this;
    this._init();
}